<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pln_inco.temantex.AnotAtrib</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >alan</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;pln_inco ::
        Package&nbsp;temantex ::
        Module&nbsp;AnotAtrib
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="pln_inco.temantex.AnotAtrib-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="pln_inco.temantex.AnotAtrib-module.html">Module pln_inco.temantex.AnotAtrib</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: UTF-8 -*-</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">xml</tt><tt class="py-op">.</tt><tt class="py-name">dom</tt><tt class="py-op">.</tt><tt class="py-name">minidom</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"> </tt>
<a name="Anotacion"></a><div id="Anotacion-def"><a name="L5"></a><tt class="py-lineno"> 5</tt> <a class="py-toggle" href="#" id="Anotacion-toggle" onclick="return toggle('Anotacion');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Anotacion-class.html">Anotacion</a><tt class="py-op">:</tt> </tt>
</div><div id="Anotacion-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="Anotacion-expanded"><a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line">        <tt class="py-docstring">"""Representa una anotacion de evento o indice, con sus atributos."""</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"> </tt>
<a name="Anotacion.__init__"></a><div id="Anotacion.__init__-def"><a name="L8"></a><tt class="py-lineno"> 8</tt> <a class="py-toggle" href="#" id="Anotacion.__init__-toggle" onclick="return toggle('Anotacion.__init__');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Anotacion-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">annot</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Anotacion.__init__-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Anotacion.__init__-expanded"><a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">annot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'mention'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">annot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'span'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt> <tt class="py-keyword">and</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">annot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'spannedText'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">childNodes</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line">                        <tt class="py-name">span</tt> <tt class="py-op">=</tt> <tt class="py-name">annot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'span'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line">                        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">ini</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">span</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'start'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line">                        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fin</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">span</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'end'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt> </tt>
<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line">                         </tt>
<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line">                        <tt class="py-comment"># Guardamos el texto que representa al evento</tt> </tt>
<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line">                        <tt class="py-comment"># self.spannedText = annot.getElementsByTagName('spannedText')[0].childNodes[0].data</tt> </tt>
<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line">                        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">ini</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> </tt>
<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line">                        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fin</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> </tt>
</div><a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"> </tt>
<a name="Anotacion.set_atributos"></a><div id="Anotacion.set_atributos-def"><a name="L21"></a><tt class="py-lineno">21</tt> <a class="py-toggle" href="#" id="Anotacion.set_atributos-toggle" onclick="return toggle('Anotacion.set_atributos');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Anotacion-class.html#set_atributos">set_atributos</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">attset</tt><tt class="py-op">,</tt> <tt class="py-param">attribs_por_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Anotacion.set_atributos-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Anotacion.set_atributos-expanded"><a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line">                <tt class="py-name">atributos</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tipo</tt> <tt class="py-op">=</tt> <tt class="py-name">attset</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'mentionClass'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">hasSlotMention</tt> <tt class="py-keyword">in</tt> <tt class="py-name">attset</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'hasSlotMention'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line">                        <tt class="py-name">attrib_id</tt> <tt class="py-op">=</tt> <tt class="py-name">hasSlotMention</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line">                        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attribs_por_id</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">attrib_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line">                                <tt class="py-comment">#print 'Warning: no se encontro el atributo ' + attrib_id + ', es un atributo complejo?'</tt> </tt>
<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line">                                <tt class="py-keyword">pass</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line">                        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line">                                <tt class="py-name">atributos</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">attribs_por_id</tt><tt class="py-op">[</tt><tt class="py-name">attrib_id</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">atributos</tt> <tt class="py-op">=</tt> <tt class="py-name">atributos</tt> </tt>
</div><a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line">         </tt>
<a name="Anotacion.open_tag"></a><div id="Anotacion.open_tag-def"><a name="L33"></a><tt class="py-lineno">33</tt> <a class="py-toggle" href="#" id="Anotacion.open_tag-toggle" onclick="return toggle('Anotacion.open_tag');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Anotacion-class.html#open_tag">open_tag</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Anotacion.open_tag-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Anotacion.open_tag-expanded"><a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line">                <tt class="py-name">atributos_str</tt> <tt class="py-op">=</tt> <tt class="py-string">' '</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">a</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Method pln_inco.temantex.AnotAtrib.Atributo.toString()=pln_inco.temantex.AnotAtrib.Atributo-class.html#toString"><a title="pln_inco.temantex.AnotAtrib.Atributo.toString" class="py-name" href="#" onclick="return doclink('link-0', 'toString', 'link-0');">toString</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">a</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">atributos</tt><tt class="py-op">)</tt> </tt>
<a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-string">'&lt;'</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tipo</tt> <tt class="py-op">+</tt> <tt class="py-string">' '</tt> <tt class="py-op">+</tt> <tt class="py-name">atributos_str</tt> <tt class="py-op">+</tt> <tt class="py-string">'&gt;'</tt> </tt>
</div><a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line"> </tt>
<a name="Anotacion.close_tag"></a><div id="Anotacion.close_tag-def"><a name="L37"></a><tt class="py-lineno">37</tt> <a class="py-toggle" href="#" id="Anotacion.close_tag-toggle" onclick="return toggle('Anotacion.close_tag');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Anotacion-class.html#close_tag">close_tag</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Anotacion.close_tag-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Anotacion.close_tag-expanded"><a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-string">'&lt;/'</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tipo</tt> <tt class="py-op">+</tt> <tt class="py-string">'&gt;'</tt> </tt>
</div></div><a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line"> </tt>
<a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line"> </tt>
<a name="Atributo"></a><div id="Atributo-def"><a name="L41"></a><tt class="py-lineno">41</tt> <a class="py-toggle" href="#" id="Atributo-toggle" onclick="return toggle('Atributo');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Atributo-class.html">Atributo</a><tt class="py-op">:</tt> </tt>
</div><div id="Atributo-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="Atributo-expanded"><a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line">        <tt class="py-docstring">"""Representa el atributo de una anotacion, por ejemplo modo o factividad."""</tt> </tt>
<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line"> </tt>
<a name="Atributo.__init__"></a><div id="Atributo.__init__-def"><a name="L44"></a><tt class="py-lineno">44</tt> <a class="py-toggle" href="#" id="Atributo.__init__-toggle" onclick="return toggle('Atributo.__init__');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Atributo-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slot</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Atributo.__init__-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Atributo.__init__-expanded"><a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">slot</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line">                <tt class="py-name">mentionSlot</tt> <tt class="py-op">=</tt> <tt class="py-name">slot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'mentionSlot'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">name</tt> <tt class="py-op">=</tt> <tt class="py-name">mentionSlot</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line">                <tt class="py-name">stringSlotMentionValue</tt> <tt class="py-op">=</tt> <tt class="py-name">slot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'stringSlotMentionValue'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L49"></a><tt class="py-lineno">49</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> <tt class="py-op">=</tt> <tt class="py-name">stringSlotMentionValue</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'value'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
</div><a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line">         </tt>
<a name="Atributo.toString"></a><div id="Atributo.toString-def"><a name="L51"></a><tt class="py-lineno">51</tt> <a class="py-toggle" href="#" id="Atributo.toString-toggle" onclick="return toggle('Atributo.toString');">-</a><tt class="py-line">        <tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib.Atributo-class.html#toString">toString</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Atributo.toString-collapsed" style="display:none;" pad="++" indent="++++++++++++"></div><div id="Atributo.toString-expanded"><a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">name</tt> <tt class="py-op">+</tt> <tt class="py-string">'="'</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> <tt class="py-op">+</tt> <tt class="py-string">'"'</tt> </tt>
</div></div><a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line"> </tt>
<a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line"> </tt>
<a name="obtenerAnotaciones"></a><div id="obtenerAnotaciones-def"><a name="L55"></a><tt class="py-lineno">55</tt> <a class="py-toggle" href="#" id="obtenerAnotaciones-toggle" onclick="return toggle('obtenerAnotaciones');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="pln_inco.temantex.AnotAtrib-module.html#obtenerAnotaciones">obtenerAnotaciones</a><tt class="py-op">(</tt><tt class="py-param">annotations_file</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="obtenerAnotaciones-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="obtenerAnotaciones-expanded"><a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line">        <tt class="py-docstring">"""Retorna un diccionario de anotaciones (elementos de clase Anotacion), indexado por</tt> </tt>
<a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line"><tt class="py-docstring">        la posici&#243;n inicial de la anotaci&#243;n.</tt> </tt>
<a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line"><tt class="py-docstring">        De esta forma, haciendo anots = obtenerAnotaciones(archivo_knowtator.xml) podremos</tt> </tt>
<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line"><tt class="py-docstring">        referenciar a la anotaci&#243;n que comienza en el caracter 56 haciendo simplemente anots[56]."""</tt> </tt>
<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line"> </tt>
<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line">        <tt class="py-name">annot_doc</tt> <tt class="py-op">=</tt> <tt class="py-name">xml</tt><tt class="py-op">.</tt><tt class="py-name">dom</tt><tt class="py-op">.</tt><tt class="py-name">minidom</tt><tt class="py-op">.</tt><tt class="py-name">parse</tt><tt class="py-op">(</tt><tt class="py-name">annotations_file</tt><tt class="py-op">)</tt> </tt>
<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line">         </tt>
<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line">        <tt class="py-comment">#print 'Cargando valores de atributos'</tt> </tt>
<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line">        <tt class="py-name">attribs</tt> <tt class="py-op">=</tt> <tt class="py-name">annot_doc</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'stringSlotMention'</tt><tt class="py-op">)</tt> </tt>
<a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line">        <tt class="py-name">attribs_por_id</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">attrib</tt> <tt class="py-keyword">in</tt> <tt class="py-name">attribs</tt><tt class="py-op">:</tt> </tt>
<a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line">                <tt class="py-comment">#if len(attrib.getElementsByTagName('mentionSlot')) == 0:</tt> </tt>
<a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line">                <tt class="py-comment">#       print attrib.attributes['id'].value + " no tiene atributo asociado (mentionSlot)"</tt> </tt>
<a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line">                <tt class="py-name">a</tt> <tt class="py-op">=</tt> <tt id="link-1" class="py-name" targets="Class pln_inco.temantex.AnotAtrib.Atributo=pln_inco.temantex.AnotAtrib.Atributo-class.html"><a title="pln_inco.temantex.AnotAtrib.Atributo" class="py-name" href="#" onclick="return doclink('link-1', 'Atributo', 'link-1');">Atributo</a></tt><tt class="py-op">(</tt><tt class="py-name">attrib</tt><tt class="py-op">)</tt> </tt>
<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line">                <tt class="py-name">attribs_por_id</tt><tt class="py-op">[</tt><tt class="py-name">a</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">a</tt> </tt>
<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line">         </tt>
<a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line">        <tt class="py-comment">#print 'Cargando conjuntos de atributos'</tt> </tt>
<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line">        <tt class="py-name">attsets</tt> <tt class="py-op">=</tt> <tt class="py-name">annot_doc</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'classMention'</tt><tt class="py-op">)</tt> </tt>
<a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line">        <tt class="py-name">attsets_por_id</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">attset</tt> <tt class="py-keyword">in</tt> <tt class="py-name">attsets</tt><tt class="py-op">:</tt> </tt>
<a name="L77"></a><tt class="py-lineno">77</tt>  <tt class="py-line">                <tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">attset</tt><tt class="py-op">.</tt><tt class="py-name">attributes</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">value</tt> </tt>
<a name="L78"></a><tt class="py-lineno">78</tt>  <tt class="py-line">                <tt class="py-name">attsets_por_id</tt><tt class="py-op">[</tt><tt class="py-name">id</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">attset</tt> </tt>
<a name="L79"></a><tt class="py-lineno">79</tt>  <tt class="py-line">         </tt>
<a name="L80"></a><tt class="py-lineno">80</tt>  <tt class="py-line">        <tt class="py-comment">#print 'Cargando anotaciones'</tt> </tt>
<a name="L81"></a><tt class="py-lineno">81</tt>  <tt class="py-line">        <tt class="py-name">annots</tt> <tt class="py-op">=</tt> <tt class="py-name">annot_doc</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'annotation'</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno">82</tt>  <tt class="py-line">        <tt class="py-name">annots_por_pos</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L83"></a><tt class="py-lineno">83</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">annot</tt> <tt class="py-keyword">in</tt> <tt class="py-name">annots</tt><tt class="py-op">:</tt> </tt>
<a name="L84"></a><tt class="py-lineno">84</tt>  <tt class="py-line">                <tt class="py-name">a</tt> <tt class="py-op">=</tt> <tt id="link-2" class="py-name" targets="Class pln_inco.temantex.AnotAtrib.Anotacion=pln_inco.temantex.AnotAtrib.Anotacion-class.html"><a title="pln_inco.temantex.AnotAtrib.Anotacion" class="py-name" href="#" onclick="return doclink('link-2', 'Anotacion', 'link-2');">Anotacion</a></tt><tt class="py-op">(</tt><tt class="py-name">annot</tt><tt class="py-op">)</tt> </tt>
<a name="L85"></a><tt class="py-lineno">85</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">annot</tt><tt class="py-op">.</tt><tt class="py-name">getElementsByTagName</tt><tt class="py-op">(</tt><tt class="py-string">'span'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L86"></a><tt class="py-lineno">86</tt>  <tt class="py-line">                        <tt class="py-comment">#print 'Warning: la anotacion ' + a.id + ' no tiene un span definido'</tt> </tt>
<a name="L87"></a><tt class="py-lineno">87</tt>  <tt class="py-line">                        <tt class="py-keyword">pass</tt> </tt>
<a name="L88"></a><tt class="py-lineno">88</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L89"></a><tt class="py-lineno">89</tt>  <tt class="py-line">                        <tt class="py-name">attset</tt> <tt class="py-op">=</tt> <tt class="py-name">attsets_por_id</tt><tt class="py-op">[</tt><tt class="py-name">a</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">]</tt> </tt>
<a name="L90"></a><tt class="py-lineno">90</tt>  <tt class="py-line">                        <tt class="py-name">a</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Method pln_inco.temantex.AnotAtrib.Anotacion.set_atributos()=pln_inco.temantex.AnotAtrib.Anotacion-class.html#set_atributos"><a title="pln_inco.temantex.AnotAtrib.Anotacion.set_atributos" class="py-name" href="#" onclick="return doclink('link-3', 'set_atributos', 'link-3');">set_atributos</a></tt><tt class="py-op">(</tt><tt class="py-name">attset</tt><tt class="py-op">,</tt> <tt class="py-name">attribs_por_id</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno">91</tt>  <tt class="py-line">                        <tt class="py-name">annots_por_pos</tt><tt class="py-op">[</tt><tt class="py-name">a</tt><tt class="py-op">.</tt><tt class="py-name">ini</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">a</tt> </tt>
<a name="L92"></a><tt class="py-lineno">92</tt>  <tt class="py-line">         </tt>
<a name="L93"></a><tt class="py-lineno">93</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">annots_por_pos</tt> </tt>
</div><a name="L94"></a><tt class="py-lineno">94</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >alan</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Oct 21 00:21:15 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
